package cn.chencaiju.day10;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;

import org.junit.Test;

public class InputStreamTest {
	
	public void InputStreamRead(File file) {
		try(FileInputStream fi=new FileInputStream(file);) {
//			int c=fi.read();
//			System.out.println(c);
			byte[] b = new byte[100];
			int n=fi.read(b);
			for(int i=0;i<n;i++) {
				System.out.print((char)b[i]);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e1) {
			e1.printStackTrace();
		}		
	}
	@Test public void testInputStream() {
		File dir=new File("data/d1");
		File file=new File(dir,"test.txt");
		InputStreamRead(file);
	}
}
